Carbon


RelString

Header: StringCompare.h Carbon status: Supported

Compares two Pascal strings using the string comparison rules of the Macintosh file system and returns a value that indicates the sorting order of the first string relative to the second string.

SInt16 RelString (
    ConstStr255Param str1, 
    ConstStr255Param str2, 
    Boolean caseSensitive, 
    Boolean diacSensitive
);
Parameter descriptions
str1

One of the Pascal strings to be compared.

str2

The other Pascal string to be compared.

caseSensitive

A flag that indicates how to handle case-sensitive information during the comparison. If the value of caseSens is TRUE, uppercase characters are distinguished from the corresponding lowercase characters. If it is FALSE, case information is ignored.

diacSensitive

A flag that indicates how to handle information about diacritical marks during the string comparison. If the value of diacSensitive is TRUE, characters with diacritical marks are distinguished from the corresponding characters without diacritical marks during the comparison. If it is FALSE, diacritical marks are ignored.

function result

Returns –1 if the first string is less than the second string, 0 if the two strings are equal, and 1 if the first string is greater than the second string. It compares the two strings in the same manner as does the EqualString function, by simply looking at the ASCII values of their characters. However, RelString provides more information about the two strings—it indicates their relationship to each other, rather than determining if they are exactly equal.

DISCUSSION

This function does not make use of any script or language information; it assumes the original Macintosh character set only.

SPECIAL CONSIDERATIONS

The RelString function is not localizable and does not work properly with non-Roman script systems.

AVAILABILITY

Supported in Carbon. Available in Carbon 1.0.2 and later when running Mac OS 8.1 or later.


© 2000 Apple Computer, Inc. (Last Updated 6/30/2000)